/*
 * @Author: yixin
 * @Date: 2018-02-26 17:52:20
 * @Last Modified by: yixin
 * @Last Modified time: 2018-07-03 18:05:00
 * 页面包裹组件
 */
import React, { PureComponent } from 'react';
import { View } from 'react-native';
import { createStyles } from '../../utils/view';
import { Navigation } from 'react-native-navigation';
import LoadingView from './loadingView';
import Storage from '../../utils/storage';

class Scene extends PureComponent {
  render() {
    let { isLoading, style, error, children, onRetry, auth } = this.props;
    // const token = Storage.load('token');
    // if (auth && !token) {
    //   Navigation.showModal({
    //     screen: 'Login',
    //     title: '登录',
    //     passProps: {},
    //     animated: true,
    //     animationType: 'slide-horizontal',
    //     navigatorStyle: {},
    //     navigatorButtons: {}
    //   });
    // }
    return (
      <View style={styles.container}>
        {/* {!isLoading && children} */}
        {children}
        {/* <ErrorView text={error} onPress={onRetry} /> */}
        {isLoading && <LoadingView isLoading={isLoading} />}
      </View>
    );
  }
}

let styles = {
  container: {
    flex: 1,
  }
};
styles = createStyles(styles);

export default Scene;
